from common.base import models
from common.base import fields


class Area(models.Model):
    name = fields.CharField(max_length=20, description='名称')
    parent = fields.ForeignKeyField('models.Area', on_delete=fields.SET_NULL, related_name='subs'
                                    , null=True, blank=True, description='上级行政区')
    subs: fields.ReverseRelation["Area"]

    class Meta:
        table = 'tb_areas'
        
    
    # https://gitee.com/ma_hugh/meiduo_mall/blob/master/meiduo_mall/data/areas.sql
